<?php
$time=microtime();
$tb=array("drug","user","history","drug_history","hospital","test");
$tbn=5;
$table=$tb[$tbn];
function D($a){
	include "db2.php";
	return $db_mssql[$a];
}

$coninfo=array(
	"UID"=>D('DB_USER'),
	"PWD"=>D('DB_PWD'),
	"Database"=>D('DB_S'),
);
print_r(D('DB_S'))."<br/>";
$ser="'(".D('DB_HOST').")'";
$my_con=sqlsrv_connect($ser,$coninfo);
if(!$my_con===false){
		die( print_r( sqlsrv_errors(), true));
	}else{ echo "OK";}
$time_end=microtime();
echo $time_end-$time."<br/>";
sqlsrv_close( $my_con);
$time=microtime();
try{
	$cons=new PDO("sqlsrv:server=".$ser,D('DB_USER'),D('DB_PWD'));
	$cons->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); 
   }

   catch( PDOException $e ) {
      die( "Error connecting to SQL Server" ); 
   }
$time_end=microtime();
echo $time_end-$time;
?>